'use strict';
exports.main = async (event, context) => {
  const db = uniCloud.database()
  const articleColl = db.collection('opendb-news-articles')
  
  // 验证用户登录
  if (!context.uid) {
    throw new Error('请先登录')
  }

  return await articleColl.doc(event.articleId).update({
    like_count: db.command.inc(1)
  })
}